<?php

class SFC_DB
{
	public $connection = NULL;
	public $result = NULL;

	public function __construct($dbHost = DB_HOST, $dbUser = DB_USER, $dbPass = DB_PASS, $dbDB = DB_DB, $dbDriver = DB_DRIVER)
	{
		$this->connection = mysqli_connect($dbHost, $dbUser, $dbPass, $dbDB);
	}
	
	public function query($query)
	{
		$this->result = mysqli_query($this->connection, $query);
	}
	
	public function update($query)
	{
		$this->result = mysqli_query($this->connection, $query) ? true : false;
	}
	
	public function fetch()
	{
		return mysqli_fetch_array($this->result);
	}
	
	public function fetchAssoc()
	{
		return mysqli_fetch_assoc($this->result);
	}
	
	public function fetchObject() {
		return mysqli_fetch_object($this->result);
	}
	
	public function toArray() {
		$array = array();
		while ( $row = $this->fetch() )
			$array[] = $row;
		return $array;
	}
}

?>